//package com.hdaccp.gymxmjpa.real;
//
//import com.hdaccp.gymxmjpa.Dao.AdminuserDao;
//import com.hdaccp.gymxmjpa.entity.Adminuser;
//import org.apache.shiro.authc.*;
//import org.apache.shiro.authz.AuthorizationInfo;
//import org.apache.shiro.authz.SimpleAuthorizationInfo;
//import org.apache.shiro.realm.AuthorizingRealm;
//import org.apache.shiro.subject.PrincipalCollection;
//import org.springframework.beans.factory.annotation.Autowired;
//
//public class MyRealm extends AuthorizingRealm {
//
//    private AdminuserDao adminuserDao;
//
//    @Override
//    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
//        System.out.println("已授权");
//        Adminuser user = (Adminuser) principalCollection.getPrimaryPrincipal() ;
//        //
//        SimpleAuthorizationInfo info = new SimpleAuthorizationInfo() ;
//        return null;
//    }
//
//    @Override
//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
////        //数据库的用户名为
////        String uname = "zhen" ;
////        //数据库中的密码
////        String password = "123" ;
//
//
//        UsernamePasswordToken token = (UsernamePasswordToken)authenticationToken ;
//        Adminuser a=adminuserDao.findByAdminNameAnAndAdminmima(token.getUsername(),token.get)
//
//        if(!uname.equals(username)){
//            return null ;
//        }
//
//        SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(username,password,"") ;
//        System.out.println("完成认证！");
//        return info;
//    }
//}
